package com.ckd.flyingtrip.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.ckd.flyingtrip.R;
import com.ckd.flyingtrip.activity.Alipay;
import com.ckd.flyingtrip.activity.BaseActivity;
import com.ckd.flyingtrip.dialog.PayWayDialog;
import com.ckd.flyingtrip.utils.Tools;

//钱包押金
public class MyWallet_Yajin extends Fragment {
    private PayWayDialog.Builder pb;
    BaseActivity baseActivity;
    public MyWallet_Yajin(BaseActivity baseActivity){
        this.baseActivity = baseActivity;
    }
    private TextView btn_chongzhi,txt_money,btn_close;
//    private Weixin weixin;
    private Alipay alipay;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v=inflater.inflate(R.layout.fragment_yajin, container,false);
        btn_chongzhi =  v.findViewById(R.id.btn_chongzhi);
        txt_money =  v.findViewById(R.id.txt_money);
        btn_close =  v.findViewById(R.id.btn_close);
        btn_chongzhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pb = new PayWayDialog.Builder(getContext(),
                        new PayWayDialog.Builder.PriorityListener() {
                            @Override
                            public void refreshPriorityUI(String type) {
                                volleyQueryFei(type);
                                pb.create().dismiss();
                            }
                        });
                pb.create().show();
            }
        });
        btn_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Tools.toast("退款");
            }
        });
        return v;
    }

    /*
     * 查询费用 准备掉起支付
     * */
    public void volleyQueryFei(String type) {
        if (type.equals("weixin")) {
//            weixin = new Weixin(My_Account_Activity.this, "");
//            weixin.show_My_Account_Activity("03",fylxdm_type);
        } else if (type.equals("alipay")) {
            alipay = new Alipay(baseActivity, "");
//            alipay.volleyQueryZhifu(fylxdm_type);
        }
    }
}
